/**
 * Author: Dmitry Ustimov
 * Date: 5/11/13
 * Time: 9:56 PM
 */

package com.gmail.dmitryustimov.ms.java7.composite.classic.work.demo.structure10000_2_4_8_16;

import java.math.BigDecimal;

public class Composite<T> extends Component {

    private String name;
    private BigDecimal sum = BigDecimal.valueOf(0);

    public Composite(String name) {
        super();
        this.name = name;
    }

    public boolean isComposite() {
        return true;
    }

    @Override
    public void doAction() {
        sum.add(BigDecimal.valueOf(1));
        for (Component c: components) {
            c.doAction();
        }
    }
}
